---
layout: "default"
title: "ExpressibleByNilLiteral"
description: "Swift documentation for 'ExpressibleByNilLiteral': A type that can be initialized using the nil literal, nil."
keywords: "ExpressibleByNilLiteral,protocol,swift,documentation"
root: "/v3.1"
---

<div class="intro-declaration"><code class="language-swift">protocol ExpressibleByNilLiteral</code></div>

<div class="discussion comment">
    <p>A type that can be initialized using the nil literal, <code>nil</code>.</p>

<p><code>nil</code> has a specific meaning in Swift---the absence of a value. Only the
<code>Optional</code> type conforms to <code>ExpressibleByNilLiteral</code>.
<code>ExpressibleByNilLiteral</code> conformance for types that use <code>nil</code> for other
purposes is discouraged.</p>

<p><strong>See Also:</strong> <code>Optional</code></p>
</div>

<table class="standard">
<tr>
<th id="inheritance">Inheritance</th>
<td>
<span class="viz"><a href="hierarchy/">View Protocol Hierarchy &rarr;</a></span>
</td>
</tr>



<tr>
<th>Import</th>
<td><code class="language-swift">import Swift</code></td>
</tr>

</table>


<h3>Initializers</h3>
<div class="declaration" id="init-nilliteral_">
<a class="toggle-link" data-toggle="collapse" href="#comment-init-nilliteral_">init(<wbr>nilLiteral:)</a> <span class="required">Required</span><div class="comment collapse" id="comment-init-nilliteral_"><div class="p">
    <p>Creates an instance initialized with <code>nil</code>.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">init(nilLiteral: ())</code>

    </div></div>
</div>







